package Gui;

import java.awt.Color;

import javax.swing.JPanel;
import javax.swing.JButton;
import java.awt.Font;
import javax.swing.JLabel;

import Logic.LoginInfo;
import Messages.GetLatesBooks;
import client.LibaryMain;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import javax.swing.ImageIcon;

import ocsf.server.ConnectionToClient;
/**
 * this class implements gui of main report menu 
 * @author Ron Shenkerman
 * @author Gabi Revah
 * @author Aviad Almog
 * @author Ivan Onyshchenko
 */
public class ReportsMain extends JPanel {
	
	/**
	 * Constructor
	 */
	public ReportsMain() {
	
		initcomponents();
	
	}
	 
    /**
	 * this function create instance of Reports Main gui 
	 */
	public void initcomponents()
	{
	setBackground(new Color(153, 204, 255));
	setSize(1000,710);
	setLayout(null);
	
	JButton btnActivityRepory = new JButton("Activity Repory");
	btnActivityRepory.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			
		
			ArrayList<Object> arr= new ArrayList<Object>();
			arr.add("ActivityReport");
			LibaryMain.chat.handleMessageFromGui(arr);
		
			
		}
	});
	btnActivityRepory.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));
	btnActivityRepory.setBounds(336, 184, 288, 50);
	add(btnActivityRepory);
	
	JButton btnLendingReport = new JButton("Lending Report");
	btnLendingReport.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			
			ArrayList<String> Arr=new ArrayList<String>();
	        Arr.add("GetLendReport");
	        LibaryMain.chat.handleMessageFromGui(Arr);	
		//	LendingReport reportlending = new LendingReport();
		///	MainScreen.card.add("reportlending", reportlending);
		///	MainScreen.cardLayot.show(MainScreen.card, "reportlending");
			
		}
	});
	btnLendingReport.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));
	btnLendingReport.setBounds(336, 277, 288, 50);
	add(btnLendingReport);
	
	JButton btnReturnBook = new JButton("Return Books Report");
	btnReturnBook.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			ReturnsReport returnsreport = new ReturnsReport();
			MainScreen.card.add("returnsreport", returnsreport);
			MainScreen.cardLayot.show(MainScreen.card, "returnsreport");
			
			
		}
	});
	btnReturnBook.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));
	btnReturnBook.setBounds(336, 373, 288, 50);
	add(btnReturnBook);
	
	JLabel lblReportsMenu = new JLabel("Reports Menu");
	lblReportsMenu.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 26));
	lblReportsMenu.setBounds(76, 63, 244, 25);
	add(lblReportsMenu);
	
	JButton btnBack = new JButton("Back");
	btnBack.addActionListener(new ActionListener() {
		
		public void actionPerformed(ActionEvent arg0) {
			MainScreen.cardLayot.show(MainScreen.card, "DirectorWindow");
			
		}
	});
	btnBack.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 14));
	btnBack.setBounds(145, 575, 97, 25);
	add(btnBack);
	
	JButton btnLogout = new JButton("Logout");
	btnLogout.addActionListener(new java.awt.event.ActionListener() {      
        public void actionPerformed(java.awt.event.ActionEvent ev) {
        	btnLogOut(ev);				
		}
        
		private void btnLogOut(ActionEvent ev) {
			ArrayList<String> Arr=new ArrayList<String>();
			Arr.add("Logout");
			Arr.add("Worker");
			Arr.add(LoginInfo.UserName);
			LibaryMain.chat.handleMessageFromGui(Arr);
			MainScreen.cardLayot.show(MainScreen.card, "Login");
			
		}
    });
	btnLogout.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 14));
	btnLogout.setBounds(735, 575, 97, 25);
	add(btnLogout);
	
	JLabel label = new JLabel("");
	label.setIcon(new ImageIcon(ReportsMain.class.getResource("/Gui/images/1211808846.png")));
	label.setBounds(387, 224, 546, 396);
	add(label);
	}
}



